package Day_05;
import java.util.Scanner;
import java.util.Arrays;
public class StandardThree {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("Please Enter the Number(10) and the Scale(100):");
        int num = scan.nextInt() , scale = scan.nextInt();
        int[] a = new int[num];
        for (int i = 0; i < a.length; i++) {
            a[i] = (int)(Math.random()*scale);
            System.out.print(a[i]+"\t");
        }System.out.println();
        int max = a[0], min = a[0];
        for (int i = 1; i < a.length; i++) {
            if (max < a[i]) {
                max = a[i];
            }
        }
        // ^^^-----------find max--------------^^^
        // vvv---------Extend Array------------vvv
        a = Arrays.copyOf(a,a.length+1);
        a[a.length-1] = max;
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]+"\t");
        }

    }
}
